<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>Java知识图谱在线学习系统首页</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">
	<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>通知公告</h5>
					</div>
					<div class="ibox-content" id="noticelist">
					</div>
				</div>
			</div>
	</div>
</div>
    <script th:src="@{/js/jquery.min.js}"></script>
	<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.7.3}"></script>
	<script src="../static/ruoyi/js/common.js?v=4.7.3" th:src="@{/ruoyi/js/common.js?v=4.7.3}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
    <script type="text/javascript">
		$(function () {
			/**
			 * 获取通知公告列表
			 */
			$.ajax({
				url: "/getNoticelist",
				async: false,//同步方式
				type: "GET",
				success: function (res) {
					console.log(res)
					var html = "";
					if (res.code == 0) {
						if (res.data.length > 0) {
							// for (var n = 0; n < res.data.length; n++) {
							// 	html += '<div class="alert alert-info" >';
							// 	html += '<a href="javascript:void(0);" onClick="noticeDetail(' + res.data[n].noticeId + ')" href="" class="alert-link"  title="' + res.data[n].noticeTitle + '">' + res.data[n].noticeTitle + '</a>';
							// 	html += '</a><span class="label label-primary pull-right">' + res.data[n].createTime + '</span></div>';
							// }

							//倒叙输出
							for (var n = res.data.length-1 ; n >= 0; n--) {
								html += '<div class="alert alert-info" >';
								html += '<a href="javascript:void(0);" onClick="noticeDetail(' + res.data[n].noticeId + ')" href="" class="alert-link"  title="' + res.data[n].noticeTitle + '">' + res.data[n].noticeTitle + '</a>';
								html += '</a><span class="label label-primary pull-right">' + res.data[n].createTime + '</span></div>';
							}
							$("#noticelist").html(html);
						} else {
							$("#noticelist").html("暂无数据")
						}
					} else {
						console.log(("数据获取是失败了！"))
					}
				}
			});
		})
		function noticeDetail(id){
			var url = "/noticedetail/"+id;
			$.modal.open("通知公告详情", url);
		}
    </script>
</body>
</html>
